package com.kefu.robot.vo;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;

import com.kefu.common.context.KefuContext;
import com.kefu.common.vo.AbstractUpdateVo;
import com.kefu.robot.model.RobotDocType;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ApiModel(description = "词条类型")
public class RobotDocTypeUpdateVo extends AbstractUpdateVo<RobotDocType, String> {

    
    @NotEmpty
    @ApiModelProperty(name = "id", value = "主键")
    private String id;
    @Size(max = 32)
    @ApiModelProperty(name = "name", value = "分类名称")
    private String name;

    @Override
    public RobotDocType convert() {
        RobotDocType info = new RobotDocType();
        info.setName(name);
        KefuContext context = KefuContext.getKefuContext();
        info.setId(id);
        info.setUpdateTime(context.getNow());
        info.setUpdateUser(context.getUserId());
        return info;
    }

}